{extend name="common/main"/}

{block name="body"}
    <div class="main-title">
        <h2>{:isset($info['id'])?'编辑':'新增'} 后台菜单</h2>
    </div>
    <form action="{:url()}" method="post" class="form-horizontal">
        <div class="with-padding">
            <div class="form-item builder_item">
                <label class="item-label">标题<span class="check-tips">（用于后台显示的配置标题）</span></label>
                <div class="controls">
                    <input type="text" class="text input-large form-input-width form-control" name="title" value="{$info.title|default=''}">
                </div>
            </div>
            <div class="form-item builder_item">
                <label class="item-label">所属应用<span class="check-tips">（所属的应用模块，应用菜单必须选择，否则无法导出）</span></label>
                <div class="controls">
                    <select name="module" class="form-select-size form-control">
                        <option value="admin">系统菜单</option>
                        {volist name="Modules" id="module"}
                        <option value="{$module.name}">{$module.alias}-{$module.name}</option>
                        {/volist}
                    </select>
                </div>
            </div>
            <div class="form-item builder_item">
                <label class="item-label">图标<span class="check-tips">（用于显示在菜单左侧，不填则不显示）</span></label>
                <div class="controls">
                    <input type="text" class="text input-small form-input-width form-control" name="icon" value="{$info.icon|default=''}">
                </div>
            </div>
            <div class="form-item builder_item">
                <label class="item-label">排序<span class="check-tips">（用于分组显示的顺序）</span></label>
                <div class="controls">
                    <input type="text" class="text input-small form-input-width form-control" name="sort" value="{$info.sort|default=0}">
                </div>
            </div>
            <div class="form-item builder_item">
                <label class="item-label">链接<span class="check-tips">（系统url函数解析的路径，结构：应用/控制器/方法，系统菜单可省略模块部分）</span></label>
                <div class="controls">
                    <input type="text" class="text input-large form-input-width form-control" name="url" value="{$info.url|default=''}">
                </div>
            </div>
            <div class="form-item builder_item">
                <label class="item-label">上级菜单<span class="check-tips">（所属的上级菜单）</span></label>
                <div class="controls">
                    <select name="pid" class="form-select-size form-control">
                        {notempty name="Menus"}
                        {volist name="Menus" id="menu"}
                        <option value="{$menu.id}" selected="{if $pid == $menu.id}selected{else}false{/if}">{:htmlspecialchars_decode($menu.title_show)}</option>
                        {/volist}
                        {/notempty}
                    </select>
                </div>
            </div>
            <div class="form-item builder_item">
                <label class="item-label">分组<span class="check-tips">（用于左侧分组二级菜单）</span></label>
                <div class="controls">
                    <input type="text" class="text form-input-width form-control input-large" name="group" value="{$info.group|default=''}">
                </div>
            </div>
            <div class="form-item builder_item">
                <label class="item-label">是否隐藏<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="radio" name="hide" value="1" id="hide-1">
                    <label for="hide-1">是</label>

                    <input type="radio" name="hide" value="0" id="hide-0">
                    <label for="hide-0">否</label>
                </div>
            </div>
            
            <div class="form-item builder_item">
                <label class="item-label">菜单类型<span class="check-tips"></span></label>
                <div class="controls">
                    <input type="radio" name="type" value="1" id="type-1">
                    <label for="type-1">应用</label>

                    <input type="radio" name="type" value="0" id="type-0">
                    <label for="type-0">系统</label>
                </div>
            </div>
            <div class="form-ite builder_item">
                <label class="item-label">描述说明<span class="check-tips">（菜单详细说明）</span></label>
                <div class="controls">
                    <input type="text" class="text input-large form-control form-input-width" name="tip" value="{$info.tip|default=''}">
                </div>
            </div>
        </div>

        <div class="form-item builder_item">
            <input type="hidden" name="id" value="{$info.id|default=''}">
            <button class="btn btn-success submit-btn ajax-post" id="submit" type="submit" target-form="form-horizontal">保存</button>
            <button class="btn btn-return" onclick="javascript:history.back(-1);return false;">返回</button>
        </div>
    </form>
{/block}

{block name="script"}
    <script type="text/javascript">
        Think.setValue("pid", '{$info.pid|default=0}');
        Think.setValue("hide", '{$info.hide|default=0}');
        Think.setValue("type", '{$info.type|default=0}');
        Think.setValue("module", '{$info.module|default="admin"}');
    </script>
{/block}